#ifndef TAGDATAREQUEST_H
#define TAGDATAREQUEST_H

#include <QObject>
#include "participant.h"
#include "activity.h"
#include "qtsoap.h"
namespace Data {
    class TagDataRequest;
}

class TagDataRequest : public QObject
{
    Q_OBJECT
public:
    explicit TagDataRequest(QObject *parent = 0);
    void processTag(QByteArray tagId, QByteArray activityId, QDateTime time);
    void processTag(QByteArray tagId, QByteArray activityId, QDateTime time, QByteArray selectedTagId);
/*    void processTag(Participant *tagObj);
    void processTag(Participant *tagObj, Participant *statusChangeObj);*/
    void registrationComplete(QByteArray activityUid);

private:
    void getTagData();
    void handleGetTagDataResp(const QtSoapType& res);
    void scannedTagData(bool manualCheckIn);
    void handleScannedTagDataResp(const QtSoapType& res);
    void getActivityData();
    void handleGetActivityDataResp(const QtSoapType& res);

signals:
    void updateTag(Participant::TagType participantType, QString participantName, Participant::StatusType paticipantStatus);
    void updateTag(QString participantType, QString participantName, QString paticipantStatus);
    void updateActivity(Participant *ActivityOrganiser, QByteArray activityUid, QString activityName, QDateTime activityStartTime, QDateTime activityStopTime, int registrationTimeout);
    void updateActivityParticipent(Participant *p);
    void activityOrganiserSignal(Participant *approver, QByteArray approvedId);
    void activityUpdatedSignal(Activity::ActivityStatus status);
    void participantAdd(Participant *p);

private slots:
    void tagDataReady();
    void activityDataReady();
    void getResponse();

private:
    QtSoapHttpTransport http;
    QString currentRequest;
    QByteArray manualChangedId;
    Activity *activityData;
    QByteArray activityTagId;
    Participant *tagData;
};

#endif // TAGDATAREQUEST_H
